/*
 * Patient.java
 *
 * This class is used store details about a patient.
 *
 * 
 */

package com.javacore.day6.hospitalService.hospital;

import java.util.Scanner;
import com.javacore.day6.hospitalService.hospital.Doctor;

/**
 * This class simulates the functions and attributes of a Patient.
 *
 * @author 
 */
public class Patient {
    
    /**
     * Creates a new instance of Patient.
     */
    public Patient() {
        code = age = 0;
        name = "";
        address = "";
        symptoms = "";
        doctorCode = 0;
        doctorName = "";
    }
    
    /**
     * Method to display the details of Patient.
     */
    public void getPatientDetails() {
        System.out.println("The details about the patient are:");
        System.out.println("Code: " + code);
        System.out.println("Age: " + age);
        System.out.println("Address: " + address);
        System.out.println("Symptoms: " + symptoms);
        System.out.print("Doctor attending the patient: " + doctorName);
    }
    
    /**
     * Method to accept the details of Patient.
     */
    public void setPatientDetails() {
        Scanner input = new Scanner(System.in);
        input.useDelimiter("\n");
        
        System.out.println("Enter details about the patient:");
        System.out.println("Enter patient code:" );
        code = input.nextInt();
        System.out.println("Enter name:");
        name = input.next();
        System.out.println("Enter age:" );
        age = input.nextInt();
        System.out.println("Enter address:");
        address = input.next();
        
        System.out.println("Enter Symptoms: You can type as many lines as " +
                "you wish. Enter 0 to stop.");
        // Accept the details about various symptoms until the user types a zero
        symptoms = new Scanner(System.in).useDelimiter("0").next();
    }
    
    /**
     * Method to assign a doctor to a patient.
     */
    public void assignDoctor(String name, int code) {
        this.doctorName = name;
        this.doctorCode = code;
    }
    
    /**
     * Instance variable to store unique patient code.
     */
    private int code;
    
    /**
     * Instance variable to store name of the patient.
     */
    private String name;
    
    /**
     * Instance variable to store age of the patient.
     */
    private int age;
    
    /**
     * Instance variable to store address of the patient.
     */
    private String address;
    
    /**
     * Instance variable to store illness symptoms.
     */
    private String symptoms;
    
    /**
     * Instance variable to store code of the
     * doctor assigned to the patient.
     */
    
    private int doctorCode;
    
    /**
     * Instance variable to store name of the
     * doctor assigned to the patient.
     */
    String doctorName;
}